<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CommonMoveItem.ascx.cs" Inherits="admin_webparts_Plug_ins_CommonPage_CommonMoveItem" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<%@ Register Src="CommonPageTreeView.ascx" TagName="CommonPageTreeView" TagPrefix="uc1" %>
<style type="text/css">
#divTreeView {
    float: left;
    border: solid 1px #89D;
    height: 400px;
    min-height: 500px;
}
</style>

<div class="tip" style="height: 22px;">
    <div style=" width: 300px; float: left;"><h1><%=LanguageUtility.GetLanguageText("MOVE", Session)%> <%=_Type.ToLower() %></h1></div>
    <div style="display: block; width: 50%; height: 32px; position: relative; top: -5px; text-align: right; float: right;">
        <a title="<%=LanguageUtility.GetLanguageText("CLICK_RETURN", Session) %>" href="<%=_ReturnUrl %>"><img src="resources/images/Back.png" alt="" /></a>
    </div>
</div>
<div style="float: left;">
    <uc1:CommonPageTreeView ID="CommonPageTreeView1" runat="server" />
</div>
<script type="text/javascript">
NTTHAO.namespace('page');

NTTHAO.page.langText = [];
NTTHAO.page.langText['BLANK_DEST_ID'] = '<%=LanguageUtility.GetLanguageText("BLANK_DEST_ID", Session)%>';
NTTHAO.page.langText['MOVE_ITSELF_ERROR'] = '<%=LanguageUtility.GetLanguageText("MOVE_ITSELF_ERROR", Session)%>';

function doSubmit() {
    var oDom = YAHOO.util.Dom;

    var txtID = document.getElementById("<%=txtID.ClientID %>");
    var txtToID = document.getElementById("<%=txtToID.ClientID %>");
    
    errorMessage = CheckFieldString("noblank", txtToID, NTTHAO.page.langText['BLANK_DEST_ID']);
    if(errorMessage != "")
    {
        alert(errorMessage);
        txtToID.select();
        txtToID.focus();
        return false;
    }
<%if ("movemenu".Equals(Request.QueryString["action"], StringComparison.OrdinalIgnoreCase)) { %>
    if (txtID.value === txtToID.value) 
    {
        alert(NTTHAO.page.langText['MOVE_ITSELF_ERROR']);
        return false;
    }
<%} %>
    return true;
}
</script>
<style type="text/css">
    #spCancel1, #spSave, #spCancel2, #spSave2 {font-size:1.1em; font-weight: bold; }
    #spCancel1 button, #spSave button, #spCancel2 button, #spSave2 button { font-family: Verdana,Arial,Helvetica,sans-serif; font-weight: bold; }
</style>
<form id="frmInput" runat="server" onsubmit="return doSubmit();">
<div style="margin-left:260px;">
    <div style="overflow: hidden;">
        <div class="tip">
	        <h2 style="padding-top: 0px;"><%=_Type %></h2>
            <table cellpadding="3" cellspacing="1" border="1" class="grid" style="margin-top: 10px;">
                <tr class="even">
                    <td width="50px">ID:</td>
                    <td><asp:TextBox ID="txtID" runat="server" Width="250px" ReadOnly="true"></asp:TextBox></td>
                </tr>
                <tr class="odd">
                    <td><%=LanguageUtility.GetLanguageText("NAME", Session)%>:&nbsp;</td>
                    <td><asp:TextBox ID="txtName" runat="server" Width="250px" ReadOnly="true"></asp:TextBox></td>
                </tr>
            </table>
        </div>
    </div>
    <div style="overflow: hidden;">
        <div class="tip">
	        <h2 style="padding-top: 0px;"><%=LanguageUtility.GetLanguageText("MOVE_TO", Session)%>:</h2>
            <table cellpadding="3" cellspacing="1" border="1" class="grid" style="margin-top: 10px;">
                <tr class="even">
                    <td width="50px">ID:</td>
                    <td><asp:TextBox ID="txtToID" runat="server" Width="250px"></asp:TextBox></td>
                </tr>
                <tr class="odd">
                    <td><%=LanguageUtility.GetLanguageText("NAME", Session)%>:&nbsp;</td>
                    <td><asp:TextBox ID="txtToName" runat="server" Width="250px" ReadOnly="true"></asp:TextBox></td>
                </tr>
            </table>
        </div>
    </div>
    <p style="text-align: left;">
        <span id="spSave" class="yui-button yui-link-button yuibtn yuibtn-icon btnsave"><span class="first-child"><asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /></span></span>
        <span id="spCancel1" class="yui-button yui-link-button yuibtn yuibtn-icon btncancel"><span class="first-child"><a href="<%=_ReturnUrl %>"><%=LanguageUtility.GetLanguageText("CANCEL", Session)%></a></span></span>
        <script type="text/javascript">
            YAHOO.util.Event.onContentReady("spSave", function () {
                var spSave = new YAHOO.widget.Button("spSave");
            });
            YAHOO.util.Event.onContentReady("spCancel1", function () {
                var spCancel1 = new YAHOO.widget.Button("spCancel1");
                //spCancel1.on("click", function () {location.href='?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>';}); 
            });
        </script>
    </p>
    <div style="clear: both;"></div>
</div>

</form>
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function() {
    YAHOO.util.Dom.get('<%=txtToID.ClientID %>').setAttribute('readOnly','readonly');
    
    oTreePage.nodeClickEvent = function(data) {
        var oDom = YAHOO.util.Dom;

        oDom.get('<%=txtToID.ClientID %>').value = data.id;
        oDom.get('<%=txtToName.ClientID %>').value = data.text;
        
        //var oFrame = oDom.get('frameData');
        //oFrame.src = 'CommonPageContent.aspx?action=view&g=' + data.groupID + '&mnuid=' + data.id + '&time=' + (new Date()).getTime();
    }
});

function onFrameUnload() {
    var frm = oDom.get('frameData');
    frm.height = 1;
}

function onFrameChanged() {
    var oDom = YAHOO.util.Dom;
    
    var frm = oDom.get('frameData');
    
    if (frm) {
        //frm.height = '1px';
        
        if(typeof window.onresize == 'function') {
            window.onresize();
        }
        
        if (frm.contentDocument && frm.contentDocument.body.offsetHeight) {
            // W3C DOM (and Mozilla) syntax
            frm.height = '' + (parseInt(frm.contentDocument.body.offsetHeight, 10)) + 'px';
        } else if (frm.Document && frm.Document.body.scrollHeight) {
            // IE DOM syntax
            frm.height = '' + (parseInt(frm.Document.body.scrollHeight, 10) - 5) + 'px';
        }
    }
}
YAHOO.util.Event.onDOMReady(onFrameChanged);
<% if (_ErrorMsg != "") { %>
YAHOO.util.Event.onDOMReady(function() {
    alert('<%=_ErrorMsg %>');
});
<% } %>
</script>
